package kr.co.design302.readnote.helper;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.widget.ImageView;

public class SetBookImage 
{
	public static void setImageUrl(String imageUrl, ImageView bookImage) 
	{
		try 
		{
			URL url = new URL(imageUrl);
			HttpURLConnection conn = (HttpURLConnection) url.openConnection();
			conn.connect();
			int length = conn.getContentLength();
			InputStream is = conn.getInputStream();
			
			Bitmap bitmap = BitmapFactory.decodeStream(is);
			bookImage.setImageBitmap(bitmap);
		}
		catch(Exception e) 
		{
			e.printStackTrace();
		}
	}
}
